package cn.tao.config;

import cn.tao.base.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    /**
     * 放行路径：
     *      /login：登录
     *      /user/verifyPhone：手机号是否注册
     *      /sendCode：获取验证码
     *      /fastdfs: 注册上传文件
     *      /register:注册
     */
    @Autowired
    private LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor).addPathPatterns("/**")
                .excludePathPatterns("/login")
                .excludePathPatterns("/user/verifyPhone")
                .excludePathPatterns("/sendCode")
                .excludePathPatterns("/fastdfs")
                .excludePathPatterns("/register");

    }
}
